@layout("/common/_container_class.html"){
<div class="layui-fluid" id="editClass">
    <div class="layui-card">
        <div class="layui-card-body"style="overflow: scroll" >
            <div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto;">
                <div id="updateClass_class_edit">
                    <input type="hidden" id="orgId" value="${org.id}"/>
                    <input type="hidden" id="id" value="${ptClass.id}"/>
                    <input type="hidden" id="schoolYear1" value="${schoolYear+1}"/>
                    <input type="hidden" id="schoolYear" value="${schoolYear}"/>
                    <input type="hidden" id="fromClassId" value="${oldClass.id}"/>
                    <input type="hidden" id="classIds" value="${classIds}"/>
                    <input type="hidden" id="phase_gradeMap" value='${phase_gradeMap}'>
                    <form class="layui-form" style="margin: 0 auto;max-width: 500px;padding-top: 10px;">
                        <#input id="orgName" style=" width: 345px;margin-bottom: 16px;" name="学校名称" value="${org.name}"  disabled="disabled"/>
                        <div class="hr-line-dashed1"></div>
                        <#input id="oldClassNameId" style=" width: 345px;margin-bottom: 16px;" name="升级前名称" value="${oldClass.name}"  disabled="disabled"/>
                        <div class="hr-line-dashed1"></div>
                        <#input id="newClassNameId" style=" width: 345px;margin-bottom: 16px;" name="班级名称" value="${ptClass.name}" />
                        <div class="hr-line-dashed1"></div>
                        <#select id="period" style="margin-bottom: 16px;" name="级届"  value="${ptClass.period}" span="true">
                        @for(period in periodList){
                        <option value="${period}" ${period==ptClass.period?'selected':""}>${period}届</option>
                        @}
                    </#select>
                    <div class="hr-line-dashed1"></div>
                    <#select id="phaseId" style="margin-bottom: 16px;" name="学段" value="${ptClass.phaseId}" span="true" onchange="guanlian();">
                    @for(phaseMeta in phaseList){
                    <option value="${phaseMeta.id}" ${phaseMeta.id==ptClass.phaseId?'selected':""}>${phaseMeta.name}</option>
                    @}
                </#select>
                <div class="hr-line-dashed1"></div>
                <#select id="gradeId" name="年级" style="margin-bottom: 16px;"  onchange="changeGrade();" value="${ptClass.gradeId}" span="true">
                <option value="">请选择</option>
            </#select>
            <div class="hr-line-dashed1"></div>
            <#select id="subjectType" style="margin-bottom: 16px;" name="文理科" value="${ptClass.subjectType}" span="true" onchange="guanlian();">
            @for(subjectTypeMeta in subjectTypes){
            <option value="${subjectTypeMeta.id}" ${subjectTypeMeta.id==ptClass.subjectType?'selected':""}>${subjectTypeMeta.name}</option>
            @}
        </#select>
        <div class="hr-line-dashed1"></div>
        <#select id="classType" style=" margin-bottom: 16px;" name="班级类型" value="${ptClass.classType}" span="true" onchange="guanlian();">
        @for(meta in classTypeList){
        <option value="${meta.id}" ${meta.id==ptClass.classType?'selected':""}>${meta.name}</option>
        @}
    </#select>
    <div class="hr-line-dashed1"></div>
    <#input id="sort" style=" margin-bottom: 16px;" name="排序"  value="${ptClass.sort}" span="true"/>
    <div class="hr-line-dashed1"></div>
    <#select id="teacherId" style=" margin-bottom: 16px;" name="班主任" underline="true" >
    <option value="">请选择</option>
       @for(headmaster in headmasters){
      <option value="${headmaster.accountId}" ${headmaster.accountId==ptClass.teacherId?'selected':""}>${headmaster.name}</option>
        @}
          </#select>
                        <div class="layui-form-item" style="text-align: center">
                            <div class="layui-input-block">
                                <button type="button" class="layui-btn twoPre"  id="twostepPre" data-id="${preClassInfo.id}">${preClassInfo.id==null?'上一步':'上一个班级'}</button>
                                <button class="layui-btn"id="twostepNext"  lay-submit lay-filter="formStep2" data-id="${nextClassInfo.id}">
                                    ${nextClassInfo.id==null?'下一步':'下一个班级'}
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="${ctxPath}/static/modular/system/ptClass/classUpdate.js"></script>
<style>
    <style>
    .wrapper-content {
        padding: 4px;
    }
</style>
<script>

    $(document).ready(function(){
        if("${ptClass.phaseId}"!=""){
            $("#phaseId").val('${ptClass.phaseId}');
            guanlian();
        }
    });
    function guanlian() {
        showGradeList1();
    }
    //显示年级
    function showGradeList1() {
        var gradeOptions = "<option value=''>请选择...</option>";
        $("#gradeId").html(gradeOptions);
        var phaseId = $("#phaseId").val();
        var map = JSON.parse(($("#phase_gradeMap").val()));
        var gradeList = map[phaseId];
        if (gradeList != null) {
            $.each(gradeList, function (n, grade) {
                gradeOptions += "<option value='" + grade.id + "' ";
                if("${ptClass.gradeId}"==grade.id){
                    gradeOptions += " selected='selected' ";
                }
                gradeOptions += ">" + grade.name + "</option>";
            });
        }
        $("#gradeId").html(gradeOptions);
    };
    function changeGrade(){
        classUpdate.selectedPhaseGradeMap["gradeId"] = $("#gradeId").val();
    }
</script>
@}
